﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using Models;

namespace BLL
{
    public class B_Student
    {
        D_Student dal = new D_Student();

        public bool Add(List<Student> lst)
        {
            return dal.add(lst);
        }

        public bool Del(List<Student> lst)
        {
            return dal.del(lst);
        }

        public List<Student> GetList(int grade, int major_id)
        {
            return dal.getList(grade, major_id);
        }

        public List<Student> GetList()
        {
            return dal.getList();
        }

        public List<Student> GetPage(int page_index, int page_size, ref int totalCount)
        {
            return dal.getPage(page_index, page_size, ref totalCount);
        }

        public List<Student> GetList(StuGroup group)
        {
            return dal.getList(group);
        }

        public List<Student> GetListNotSetGroup()
        {
            return dal.getListNotSetGroup();
        }

        public bool SaveList(List<Student> lst)
        {
            return dal.saveList(lst);
        }

        public int ReleaseGroupId(StuGroup grp)
        {
            return dal.releaseGroupid(grp);
        }

        // 不需要msg,删除msg参数
        public bool UpdateGroupId(List<Student> students, int group_id)
        {
            if (dal.updateGroupid(students, group_id))
                return true;
            else 
                return false;
        }

        // 这里有Time_out函数没写
        public bool TimeOut(Student stu)
        {
            DAL.D_SysConfig d_Config = new DAL.D_SysConfig();
            return d_Config.stuTimeout(stu);
        }

        public bool Login(Student m_stu)
        {
            var res = dal.login_sugar(m_stu);
            LogInfo.Student_timeout = TimeOut(m_stu) ? true : false;
            return res;
        }

    }
}
